saving . . . saved In windows, range(1,5) not showing expected output [1,2,3,4,5], Why? has been deleted. In windows, range(1,5) not showing expected output [1,2,3,4,5], Why? has been hidden .
In windows, range(1,5) not showing expected output [1,2,3,4,5], Why?
Title
Question
In windows, range(1,5) not showing expected output [1,2,3,4,5], Why?

Python-3.4.3 Getting-started-with-for 10-11 min 0-10 sec 22-06-19, 4:36 p.m. Shrishail5

Answers:

This is not the expected output. When you run the function range, it will start from the mentioned starting point and it will end one before the destination point. In this particular case, you will be getting the output as [1,2,3,4] and not [1,2,3,4,5]. To get the output as [1,2,3,4,5], you need to write the following range function:
range(1,6)

Regards.
13-03-20, 9:04 p.m. rajdeep4ever2010@gmail.com


Log-in to answer to this question.